#!/usr/bin/env python
#-*- coding:utf-8 -*-

import sys
try:
    import pygtk
    pygtk.require('2.0')
    import gtk
    import gtk.glade
except:
    sys.exit(1)

class Application:
    def __init__(self):
        self.widget_tree = gtk.glade.XML('$gladefile')

        #Get the Main Window, and connect the 'destroy' event
        self.window = self.widget_tree.get_widget('$main_window_name')
        if self.window:
            self.window.connect('destroy', gtk.main_quit)

        #Widgets -------
        self.$widget_name = self.widget_tree.get_widget('$widget_name')

        #Autoconnect Signals and Callbacks
        self.widget_tree.signal_autoconnect(self)

    # Callbacks ---------------------------------------------------------------
    def $callback_name(self, widget${other_callback_arguments}):
        print '$callback_name'

    def run(self):
        self.window.show_all()
        return gtk.main()

def main():
    app = Application()
    sys.exit(app.run())

if __name__ == '__main__':
    main()

